<template>
	<el-drawer title="报价单详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="报价标题" prop="title">{{form.title}}</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="报价单号" prop="quotationCode">{{form.quotationCode}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="关联询价单" prop="inquiryId">{{form.inquiryTitle}}</el-form-item>
						</el-col>
					</el-row>
					<el-divider content-position="center">询价明细</el-divider>
					<scTable :data="mx" drag-sort>
						<el-table-column prop="productName" label="产品名称" width="200"></el-table-column>
						<el-table-column prop="materialCode" label="产品编码" width="150" :show-overflow-tooltip="true"></el-table-column>
						<el-table-column prop="model" label="产品型号" width="100" align="center" :show-overflow-tooltip="true"></el-table-column>
						<el-table-column prop="count" label="数量" width="50"></el-table-column>
						<el-table-column prop="unit" label="单位" width="50" align="center"></el-table-column>
						<el-table-column prop="delivery" label="交货期" width="150" align="center"></el-table-column>
						<el-table-column prop="guidePrice" label="单价" width="100" align="center"></el-table-column>
						<el-table-column prop="total" label="小计" width="100" align="center"></el-table-column>
						<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true"></el-table-column>
					</scTable>
					<el-row :gutter="24" style="margin-top: 10px;">
						<el-col :lg="12">
							<el-form-item label="税费" prop="tax">{{form.tax}}元
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="总价" prop="totalPrice">{{form.totalPrice}}/元</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="截止日期" prop="closeTime">{{form.closeTime}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="审批人" prop="approvedUser">{{form.approvedUserName}}</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="报价备注">{{ form.remark }}
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true" ></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu
	},
	data() {
		return {
			loading: false,
			form: {
				quotationId:'',
				title: '',
				quotationCode: '',
				inquiryTitle: '',
				tax:'',
				totalPrice:'',
				closeTime:'',
				approvedUserName:'',
				remark:'',
				formJson:'',
				attachId:''
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model) {
			this.model = model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			this.form.quotationId = data.quotationId
			this.form.title = data.title
			this.form.quotationCode = data.quotationCode
			this.form.inquiryTitle = data.inquiryTitle
			this.form.tax = data.tax
			this.form.totalPrice = data.totalPrice
			this.form.closeTime = data.closeTime
			this.form.approvedUserName = data.approvedUserName
			this.form.remark = data.remark
			this.form.attachId = data.attachId
			if(data.formJson!=undefined&&data.formJson!='')
			{
				this.mx = JSON.parse(data.formJson);
			}
		}
	}
}
</script>

<style>
</style>
